UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1JNUuEN8WLaB98QhsasY3pVFQ5FE2F/8DWkIYBx3RTg='
WHERE
key_id = '2f654036f23d4de55e9882b68b297fbc17f31ed718440a4e352161cd86b0c361'
AND (
token = '1JNUuEN8WLaB98QhsasY3pVFQ5FE2F/8DWkIYBx3RTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)