UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RJpe6A9vw5fQAr6209tOuzvQDl40+PpDC2R45Viji9M='
WHERE
key_id = '096b58ed5caa8ccbd152e70b9e500dee4878390d5ea4630415f63b9b1717409c'
AND (
token = 'RJpe6A9vw5fQAr6209tOuzvQDl40+PpDC2R45Viji9M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)