UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8u3KGaTLT9VDjzwsRlDbC3cBJYsTqnMI1gpOWo+AZFU='
WHERE
key_id = '51516abdcb9b5a15384e822d95a5600b23b4eced2639faf8dff6fb3960aa1ae2'
AND (
token = '8u3KGaTLT9VDjzwsRlDbC3cBJYsTqnMI1gpOWo+AZFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)