UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DyMt49pS8DsZYf87gDmMNIryVcxl1JnQrc6wxUJ+NLs='
WHERE
key_id = 'fd48a2ddfce02bff34940faa34b2e22dbe73009d4df69320f9f6d01c31b71233'
AND (
token = 'DyMt49pS8DsZYf87gDmMNIryVcxl1JnQrc6wxUJ+NLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)