UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jddEq6OkGj0nTKV3w0wet1bdBd6b94E2Z7xf01x7Il4='
WHERE
key_id = '392f350606bd68b7793d58a8c7fe78e219744322ddacd3a91af8e99bc4f7f63c'
AND (
token = 'jddEq6OkGj0nTKV3w0wet1bdBd6b94E2Z7xf01x7Il4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)