UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A2HszEXNWts17q727l0AGSytss2ZHaEcrvPrtZg/QQQ=' 
WHERE 
  key_id = 'd4b966c6cd18ac1498aa3afd4496aa72862dc54c8d1cfbb33c53d291e69d93c7' 
  AND (
    token = 'A2HszEXNWts17q727l0AGSytss2ZHaEcrvPrtZg/QQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031