UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bVzaDalq1oqMaMCxdzYeyqp71h2KTI7IACPjWoOf+D8='
WHERE
key_id = '1488540754a1cfe7090989814de47a9d7a43b18eabf9cf6300513cbdad15545e'
AND (
token = 'bVzaDalq1oqMaMCxdzYeyqp71h2KTI7IACPjWoOf+D8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)