UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8OTiAIGmCAZzYyaDLFt9lPGCZ0tqud/+JfV33rRl8U4='
WHERE
key_id = '59366e2dfd9a7154b674b109740748a5deafdac3a0427f810e0e3611faffb320'
AND (
token = '8OTiAIGmCAZzYyaDLFt9lPGCZ0tqud/+JfV33rRl8U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)