UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aw/9b+MZR7ACv9hgVO7nnXW9syW4DC99z+/3uhAjgPg=' 
WHERE 
  key_id = '115b184308f8148ab1c4c768d28084a64f953c156a916db1de77545d02537a91' 
  AND (
    token = 'aw/9b+MZR7ACv9hgVO7nnXW9syW4DC99z+/3uhAjgPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038