UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3V0vn0LwFCX0Zaj1B9RhxATrYe9tAKljLhzGrV+ZQY=' 
WHERE 
  key_id = 'a6b84b2c4d1ce68a045341d36448d461b2a53a306ba5d80c126f7fa4a16d6d65' 
  AND (
    token = 'h3V0vn0LwFCX0Zaj1B9RhxATrYe9tAKljLhzGrV+ZQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041