UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OPcf88Okmzb4dejgtYIOhv1BZppLS6k7Dwha2a7rQq0='
WHERE
key_id = 'c2a51371e4917670ad37fc26f206b8a004d12ce84a166e6b7513892e3f2835e9'
AND (
token = 'OPcf88Okmzb4dejgtYIOhv1BZppLS6k7Dwha2a7rQq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)