UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OxG5WFyYHxfUaCEXu8a5JrARav1s0usqqK94m2oxYYY=' 
WHERE 
  key_id = 'b052ddff1a630a2e72d3225fa3621e0e8a1d42d495ea6b05dd2d790bcabe2a76' 
  AND (
    token = 'OxG5WFyYHxfUaCEXu8a5JrARav1s0usqqK94m2oxYYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033