UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u4GAkGlxhNfMcw+EwMtISDUIMRqzb+xtDjocId3O8DU=' 
WHERE 
  key_id = '6dbeee014fd53a5f5372283d69cdd7eeb7bd857631fd1e15d9f9baea2960f8d8' 
  AND (
    token = 'u4GAkGlxhNfMcw+EwMtISDUIMRqzb+xtDjocId3O8DU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038