UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0lTgWDrog2Zy+IjzY2X1Wi1KyAKZrxjujvCpcqKYw5k='
WHERE
key_id = '57e18730015ac2908a3713630668f5fc981dd002b165c8b280d7e7a854a31652'
AND (
token = '0lTgWDrog2Zy+IjzY2X1Wi1KyAKZrxjujvCpcqKYw5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)