UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KnDzni4sa0N/SPwfG0i//unIkThSkGylVmQ6COdU7WQ=' 
WHERE 
  key_id = '17c1a4a0b9ee37ddcb3124bc291c28d5b214545af809025a0ce3ee4c8a7afa57' 
  AND (
    token = 'KnDzni4sa0N/SPwfG0i//unIkThSkGylVmQ6COdU7WQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041