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