UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dUPDFSBFI7pKqEU/7FwdrMi09aiy0PXnwWRpmleepBA='
WHERE
key_id = '0f3e3e91f61d6944550df779d643dd3a558ab1c0a957864c6605f20b2c20db55'
AND (
token = 'dUPDFSBFI7pKqEU/7FwdrMi09aiy0PXnwWRpmleepBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)