UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dK3888qqQOUux/M9lrzmejGqaICGSIxGa2337tSKanw=' 
WHERE 
  key_id = '24e57729f43cbad2d0acacb8c2f49ebf6c80aa0e47a2859fd64d6e438344bb73' 
  AND (
    token = 'dK3888qqQOUux/M9lrzmejGqaICGSIxGa2337tSKanw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014