UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMSrYSI6f0JxpBhpLQSMb9qP0VfmShXhGLz9568Z59w=' 
WHERE 
  key_id = '84faca2c7450242b544d934acd6c1242ab49c4f1c382212a9b0cfae9808335f5' 
  AND (
    token = 'KMSrYSI6f0JxpBhpLQSMb9qP0VfmShXhGLz9568Z59w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037