UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2RELS0kucjGef9OlN2niwraOIptlhTkQoqShRNBJlUk='
WHERE
key_id = 'bfb16390ed820bf87794271bc487e8350ee943f80cdbfcaeeebf11f97e958b1d'
AND (
token = '2RELS0kucjGef9OlN2niwraOIptlhTkQoqShRNBJlUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)