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