UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '03B0fikVIekAQNPQTEmsiuSnSUKfCpK35yDpMvts2+A='
WHERE
key_id = '1d0545d930254c2f4639aee7f626393f5816b96d8c178e0c1bfe55d6369551e1'
AND (
token = '03B0fikVIekAQNPQTEmsiuSnSUKfCpK35yDpMvts2+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)