UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e5KuRjZTW1M0hINgSdz3N4CIFLhXTpqhADCgP2WRXVA='
WHERE
key_id = 'e9b2f65428b364e5ba2653345591975ed37195cb2eebe2cd8ba85cdf893c3777'
AND (
token = 'e5KuRjZTW1M0hINgSdz3N4CIFLhXTpqhADCgP2WRXVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)