UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4S14m+C4CWVgvCfTGzBod9QhrVy4XQrf/DbODMbgQg=' 
WHERE 
  key_id = '34f5d1689907a1d6c6e8598a35b2ebc3551ed6fc95ed8e7cd8f9f18b116883c9' 
  AND (
    token = 'b4S14m+C4CWVgvCfTGzBod9QhrVy4XQrf/DbODMbgQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026