UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Eh/8GyCcDVSRlCrmstvNDXewlL9IR5tnu7hJ+Hh1/Nk='
WHERE
key_id = 'e3ca899bab5c742a56f932213b1b8e33463bebd2208943497ba9cc4db706de0e'
AND (
token = 'Eh/8GyCcDVSRlCrmstvNDXewlL9IR5tnu7hJ+Hh1/Nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)