UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1O4vWYryizMKSkZ3jpBywf4VRn251riJugnjl6hoUo='
WHERE
key_id = '5b8786286fc51a63a0924dc104831eed345298a1a4e7cb996a81c94a86aedb34'
AND (
token = 'B1O4vWYryizMKSkZ3jpBywf4VRn251riJugnjl6hoUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)