UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JL2gfXuAbEWGuJUIJWeGZncT+iLGm7Odo4QQQVfx7gU=' 
WHERE 
  key_id = '8ed4b81df3ed94feef7433300944e9e23cf4516d627cf280f0e2e0b09a7082bc' 
  AND (
    token = 'JL2gfXuAbEWGuJUIJWeGZncT+iLGm7Odo4QQQVfx7gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039