UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o3aO6VZRLH9HxRdOEO7amO8BpvwTv5vfysFQka3g/dw=' 
WHERE 
  key_id = '27fc5d95294d4edfe1d758e2e695706bb70ab9c47ac1dbd22d65aa4e0b106c84' 
  AND (
    token = 'o3aO6VZRLH9HxRdOEO7amO8BpvwTv5vfysFQka3g/dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051