UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6l2s+ZaVAV/Q3KvGiAdDLf/lW5YAEi1WThLyOPic/t4='
WHERE
key_id = 'c393f651bdb46f01f028dc1adeecbd575e6a0f9e6df523e27efd282a04279ccc'
AND (
token = '6l2s+ZaVAV/Q3KvGiAdDLf/lW5YAEi1WThLyOPic/t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)