UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ikx5B68uoPfaf0jHzo1BxVclMvcvTYb4wMWYrcqG5+8=' 
WHERE 
  key_id = '0017fe0ee1f755909aac1b353f18e0cf08b8862bf083245e087416cb15699cab' 
  AND (
    token = 'ikx5B68uoPfaf0jHzo1BxVclMvcvTYb4wMWYrcqG5+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035