UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I5wK5oLUoABtNqw01EHQSxs7NDgdDnVkug6+LSN/V/c='
WHERE
key_id = 'a3bc31021114d00c6b52f85437fd65d9f902412ffae7471164cd344faa452ac5'
AND (
token = 'I5wK5oLUoABtNqw01EHQSxs7NDgdDnVkug6+LSN/V/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)