UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K6tyoKJkvHQoLiIAS0OZdR792BRFowuoKIeIX102SP0='
WHERE
key_id = 'ad3fd2c2be1dfcf7d6d06d737f17d014c9a0b7af666194db7e0e8c605b95d0aa'
AND (
token = 'K6tyoKJkvHQoLiIAS0OZdR792BRFowuoKIeIX102SP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)