UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i4IafHv4Sby0v1i1p11D1abmVfTYiUPX7spsHBhln04=' 
WHERE 
  key_id = '09da81a1228ad4b013733f4c7ce773426bf597af98990492e91840387bef47be' 
  AND (
    token = 'i4IafHv4Sby0v1i1p11D1abmVfTYiUPX7spsHBhln04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028