UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K20WqPHZ++bYhJ6IkJkp4FYkewX7GoAaD+JPAtVaF3U='
WHERE
key_id = 'e3902ccabb23ae061093a71a5d89c0328fcf0b532c40f962598df43cd50f19ef'
AND (
token = 'K20WqPHZ++bYhJ6IkJkp4FYkewX7GoAaD+JPAtVaF3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)