UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LZ5CcC6wXbQA+ouO/mlF6Y8xFvVdIvmrXelohoZXzlE=' 
WHERE 
  key_id = 'd2897d3bf85d5f633afa6386313a76b98f080419e8ba0ce8aca1215a729b19f9' 
  AND (
    token = 'LZ5CcC6wXbQA+ouO/mlF6Y8xFvVdIvmrXelohoZXzlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041