UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IrQOL3b6thCwKX3qel5KXPCkiPPDD0Jk8Xyqo45YxLs='
WHERE
key_id = '9f371e06519abee80f8171eb8ee6b491b0473364f2f41dc53940603d112f0633'
AND (
token = 'IrQOL3b6thCwKX3qel5KXPCkiPPDD0Jk8Xyqo45YxLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)