UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E6m36Ozq7vRf81hZfQoiTb9IBeh4oHj8faa6bNtGY1g='
WHERE
key_id = '78e12fb76e1f915dd762297d80605d55ac9cbe777b53208dd9152a815714c228'
AND (
token = 'E6m36Ozq7vRf81hZfQoiTb9IBeh4oHj8faa6bNtGY1g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)